import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '../public-path'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import { Message, Table, TableColumn, Button, Input, Dialog, MessageBox, pagination } from 'element-ui'
// Vue.use(Message)
Vue.use(Button)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(mavonEditor)
Vue.use(Dialog)
Vue.use(Input)
Vue.use(pagination)
// Vue.use(MessageBox)

Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm
Vue.config.productionTip = false
let instance = null
function render() {
  instance = new Vue({
    router,
    render: h => h(App)
  }).$mount('#app')
}

// 独立运行时
if (!window.__POWERED_BY_QIANKUN__) {
  render()
}

export async function bootstrap() {
  console.log('[vue] vue app bootstraped')
}
export async function mount(props) {
  console.log('[vue] props from main framework', props)
  render(props)
}
export async function unmount() {
  console.log('unmount')
  // instance.$destroy()
  // debugger
  // instance.value.unmount()
}
